PostgreSQL:單個表的 pg_dump (PostgreSQL: pg_dump for a single table)


問題描述

PostgreSQL:單個表的 pg_dump (PostgreSQL: pg_dump for a single table)

我是 PostgreSQL 的初學者並使用以下方法進行備份:

sudo ‑u postgres pg_dumpall > /~/postgreBackup.SQL

工作正常!現在我想備份一個表“TableName”。在方案“SchemeName”中 並嘗試了

sudo ‑u postgres pg_dump ‑‑table "SchemaName"."TableName" > /~/Dummy.SQL

pg_dump: 沒有找到匹配的表

如何讓它工作?


參考解法

方法 1:

When you have case sensitive table and schema name you have to do the proper quoting of a table name. The below command should work fine as I have successfully executed it at my end.

Please make sure you are using the correct case sensitive name of database, schema and table in this command.

./pg_dump ‑‑dbname="myDatabase" ‑‑host=localhost ‑‑port=5432 ‑‑username=postgres  ‑‑table='"MyScheme"."TableName 01"' ‑‑file=Dummy

OR

./pg_dump ‑‑dbname="myDatabase" ‑‑host=localhost ‑‑port=5432 ‑‑username=postgres  ‑‑table='"MyScheme"."TableName 01"' > ~/Dummy.SQL

Disclosure: I work for EnterpriseDB (EDB)

(by StOMichaAmjad Shahzad)

參考文件

  1. PostgreSQL: pg_dump for a single table (CC BY‑SA 2.5/3.0/4.0)

#pg-dump #postgresql






相關問題

如何檢查我是否只刪除了所需的數據? (How do I check that I removed required data only?)

無法恢復 pg_dump 備份 (Unable to restore pg_dump backup)

使用帶有 Curl 的緩衝輸出將文件上傳到 ftp 服務器 (Upload a file into a ftp server using buffered output with Curl)

帶有 -C 選項的 pg_restore 不會創建數據庫 (pg_restore with -C option does not create the database)

pg_dump 數據庫轉儲是“當時”轉儲嗎? (Is a pg_dump DB dump 'at-that-time' dump?)

PSQL 數據庫傳輸和錯誤 (PSQL database transfer and errors)

Postgres pg_dump 顯示空文件 (Postgres pg_dump show empty file)

將 pg_restore 與多個轉儲一起使用時管理外鍵 (Managing foreign keys when using pg_restore with multiple dumps)

設計:在不斷創建和刪除表時運行 pg_dump (Design: running pg_dump when tables are continuously created and dropped)

轉儲文件中視圖預定義的目的是什麼 (What is the purpose of views' predefinitions in dump file)

如何附加 pg_dump 備份命令 PostgreSQL 的日誌輸出 (How to append log output of pg_dump backup command PostgreSQL)

PostgreSQL:單個表的 pg_dump (PostgreSQL: pg_dump for a single table)







留言討論